package com.star.project.cococo.api;

import com.star.framework.web.controller.BaseController;
import com.star.framework.web.domain.AjaxResult;
import com.star.project.cococo.util.CommonUtils;
import com.star.project.cococo.util.RedisUtils;
import com.star.project.system.user.domain.User;
import com.star.project.system.user.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@RestController
@Api(tags="ano接口")
@RequestMapping("/ano")
public class AnoController extends BaseController {

    @Autowired
    private CommonUtils commonUtils;
    @Autowired
    private IUserService userService;

    @ApiOperation("测试")
    @GetMapping("/test")
    @Transactional
    public AjaxResult test(@RequestParam("userName") String userName) {
        return success(userName + ",您好",new Date());
    }
/*
    @ApiOperation("1.短信验证")
    @GetMapping("/sms")
    @ResponseBody
    public AjaxResult sms(@RequestParam("mobile") String mobile) throws Exception {
        return commonUtils.sendSmsIpyy(mobile);
    }

    @ApiOperation("1.登录")
    @GetMapping("/login")
    @ResponseBody
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult login(@RequestParam("loginName") String loginName,
                            @RequestParam("password")String password) {
       return userService.checkUserLogin(loginName,password);
    }

    @ApiOperation("2.注册 ")
    @GetMapping("/register")
    @ResponseBody
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult register(@RequestParam("loginName") String loginName,
                               @RequestParam("password")String password,
                               @RequestParam("phonenumber")String phonenumber,
                               @RequestParam("verification")String verification) {
       return userService.registerApi(loginName,password,phonenumber,verification);
    }
*/
}
